# -*- coding: utf-8 -*-
# @Time : 2025/3/3 14:59
# @Author : debbyszhang
# @File : login_test.py
# @desc :
import os
import unittest

import allure
import pytest

from config import settings
from pageObject.cross_gateway_list_page import CrossGatewayListPage
from pageObject.login_page import LoginPage
from pageObject.relay_list_page import RelayListPage



@allure.feature("切换登录场景")
class TestLogin():
    def test_login(self, page):
        login_page = LoginPage(page)
        login_page.login(settings.USER_RELAY, settings.USER_RELAY_PASSWORD)

        relay_page = RelayListPage(page)
        relay_page.screenshot(path='./screenshots/relay_gateway1111-gateway.png')

        relay_page.logout()

        login_page.login(settings.USER_CROSS, settings.USER_CROSS_PASSWORD)
        cross_gateway_page = CrossGatewayListPage(page)
        cross_gateway_page.screenshot(path='./screenshots/cross-gateway.png')
        cross_gateway_page.logout()
        assert True

    def test_case02(self):
        print('sss')
        assert True
    def test_case03(self):
        print('sss')
        assert False
        # # context_cross = browser.new_context(storage_state="./playwright/.auth/cross.json")
        # # p1 = context_cross.new_page()
        # # p1.screenshot(path='./screenshots/cross-gateway11.png')
        # cross_gateway_page = CrossGatewayListPage(page_cross)
        # cross_gateway_page.screenshot(path='./screenshots/cross-gateway.png')
        #
        # # context_relay = browser1.new_context(storage_state="./playwright/.auth/relay1.json")
        # # context_relay = browser.new_context(storage_state="./playwright/.auth/relay1.json")
        # # p2 = context_relay.new_page()
        # # p2.screenshot(path='./screenshots/relay_gateway.png')
        # relay_page = RelayListPage(page_relay)
        # relay_page.screenshot(path='./screenshots/relay_gateway1111-gateway.png')
# if __name__ == '__main__':
#     # pytest.main(['-vs', '--alluredir=./result/tmp',  __file__])
#     pytest.main(['-vs', '--alluredir=./result/tmp', '--clean-alluredir', __file__])
#
#     # 离线报告
#     os.system('allure generate  ./result/tmp -o ./result/offline --clean')
#
#     # 在线报告
#     os.system('allure serve  ./result/tmp')
